import {
	request
} from "../api/request";

const upload = () => {
	uni.uploadFile({
		url: 'url', //仅为示例，非真实的接口地址
		filePath: e.tempFilePaths[0],
		name: 'file',
		// formData: {
		// 	'file': ''
		// },
		success: (uploadFileRes) => {
			console.log(uploadFileRes.data);
		},
		fail: (err) => {
			console.log(err);
		}
	})
}

/**
 * 下拉选择社区（列表）
 */
export const getGroupList = async (phone) => {
	let result = [];
	await request({
		url: '/api/v1/people-group/select?phone=' + phone,
		method: "POST"
	}).then(res => {
		result = res.data;
	})
	return result
}

/**
 * 用社区Id匹配社区名字
 */
export const getGroupName = (list,id) => {
	let name = ""
	list.forEach(item => {
		if (item.id == id) {
			name = item.name
		}
	})
	console.log(name);
	return name
}